package com.telecom.weixi.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.telecom.weixi.R;

public class BOweRowView extends LinearLayout {
	ClickAbleText oewTitle;
	TextView oweCharge;
	TextView oweMonth;
	
	int rowNum;
	OnOweListener nbrListener;
	public interface OnOweListener{
		void onOweClick(int pos);
	}
	
	public BOweRowView(Context context) {
		this(context, null);
	}
	public BOweRowView(Context context, AttributeSet attrs) {
		super(context, attrs);
		setupView(context);
	}

	void setupView(Context context){
		LayoutInflater flater = LayoutInflater.from(context);
		flater.inflate(R.layout.block_owe, this);
		this.setOnClickListener(titleListener);
		oewTitle = (ClickAbleText) findViewById(R.id.owe_nbr);
		oweCharge = (TextView) findViewById(R.id.owe_charge);
		oweMonth = (TextView) findViewById(R.id.owe_month);
	}
	
	OnClickListener titleListener = new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			if(nbrListener != null)
				nbrListener.onOweClick(rowNum);
		}
	};
	
	public void setRowNum(int num){
		rowNum = num;
	}
	public int getRowNum(){
		return rowNum;
	}
	public void setOnOweClickListener(OnOweListener l){
		nbrListener = l;
	}
	
	public void initContent(String title, String charge, String month){
		setOweNbr(title);
		setOweCharge(charge);
		setOweMonth(month);
	}
	
	public void setOweNbr(String value){
		oewTitle.setText(value);
	}
	public void setOweCharge(String value){
		oweCharge.setText(value);
	}
	public void setOweMonth(String value){
		oweMonth.setText(value);
	}
	
	
}
